package com.snack.controller;

import com.snack.common.result.Result;
import com.snack.entity.pojo.Store;
import com.snack.service.StoreService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author huangfuhao
 * @Date 2025/3/17
 */
@RestController
@RequestMapping("/api/store")
public class StoreController {
    @Resource
    private StoreService storeService;

    /**
     * 管理员新增店铺
     */
    @PostMapping("/add")
    public Result addStore(@RequestBody Store store){
        return storeService.addStore(store);
    }

    /**
     * 管理员删除店铺
     */
    @PostMapping("/delete")
    public Result deleteStore(@RequestBody Store store){
        return storeService.deleteStore(store);
    }

    /**
     * 查看店铺列表
     */
    @GetMapping("/list")
    public Result listStore(){
        return storeService.listStore();
    }

    /**
     * 修改店铺信息
     */
    @PostMapping("/update")
    public Result updateStore(@RequestBody Store store){
        return storeService.updateStore(store);
    }

}
